#include <iostream>
using namespace std;

 int main() {
     int a, b;
     int ret=0;
     cin>>a>>b;
     for(int i=a;i<=b;i++)
     {
         int tmp = i;
         //if(tmp == 2)
         //    ret++;
         while (tmp > 0)
         {
             if(tmp%10==2)
                 ret++;
             tmp = tmp / 10;
         }
     }
     cout<<ret<<endl;
     return 0;
 }